Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/247861/6/17318/58550/66c478c1Ffe6c4d45/fce20464e140ddaa.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/229341/30/20106/8804/668df123F075178fd/19ea3b9e92205f63.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/14082/25/20778/20629/668df122F3d9ed812/ab7ca0c3c11634cb.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/165568/18/43727/35175/668df121Fbc9a482a/ab15c5ba68131fc7.jpg.avif',
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/228448/8/17185/29006/668df121Ff1b22878/7c8fd6b2c1a8ec86.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img14.360buyimg.com/cms/jfs/t1/232221/28/11154/127253/659627dcF574d1351/b00719255cff2757.jpg",
      "https://img13.360buyimg.com/cms/jfs/t1/248446/22/1887/96744/659627dcF11ed035f/e008dece3f080eaa.jpg",
      "https://img11.360buyimg.com/cms/jfs/t1/247801/25/1822/111597/659627dcFf320c585/c7980a36effffd9e.jpg",
      "https://img12.360buyimg.com/cms/jfs/t1/228907/3/11314/134714/659627dcFf78a4ac5/09c6977343639662.jpg"
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})